cmake_minimum_required(VERSION 3.15.2)
# 设置工程名称和语言
project(LibLBFGS VERSION 1.1.0)
# 添加配置配件编写的函数
include(CMakePackageConfigHelpers)

if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
  set(CMAKE_INSTALL_PREFIX D:/Library)
else()
  set(CMAKE_INSTALL_PREFIX /opt/stow/liblbfgs)
endif()

message(STATUS "Platform: " ${CMAKE_HOST_SYSTEM_NAME})
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})

# 添加编译选项
option(HAVE_CONFIG_H "use config.h" ON)
option(_MSC_VER "use __msc_ver" OFF)
option(USE_SSE "use see" OFF)
# 加入一个头文件配置，让cmake对源码进行操作
configure_file(
  "${PROJECT_SOURCE_DIR}/config.h.in"
  "${PROJECT_SOURCE_DIR}/src/lib/config.h"
  )

# 添加源文件地址
add_subdirectory(src/)